package Server.ExtComponents.socket;


import Server.ServerCore.Service.Logic.ProcessSession;
import org.jboss.netty.util.DefaultObjectSizeEstimator;



public final class MServerFrameObjectSizeEstimator extends DefaultObjectSizeEstimator {
    /**
     * 估算处理的任务数量策略
     * using MemoryAwareThreadPoolExecutor independently from ExecutionHandler,
     * @param o DataProcess is Runnable task!
     * @return  int
     */
    @Override
    public int estimateSize(Object o) {
        if (o instanceof ProcessSession) {
            return ((ProcessSession) o).getBuffer().writerIndex() + 8;
        }
        return super.estimateSize(o); //default estimate
    }

}
